-
-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored: src/screens/UserPortal/Campaigns from Jest to Vitest #2640
Refactored: src/screens/UserPortal/Campaigns from Jest to Vitest #2640
Conversation
WalkthroughThe changes in this pull request involve updating the test file Changes
Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
src/screens/UserPortal/Campaigns/Campaigns.spec.tsx (1)
36-43
: Consider simplifying the DateTimePicker mockThe async mock implementation could be simplified since you're only using the DesktopDateTimePicker.
-vi.mock('@mui/x-date-pickers/DateTimePicker', async () => { - const actual = await vi.importActual( - '@mui/x-date-pickers/DesktopDateTimePicker', - ); - return { - DateTimePicker: actual.DesktopDateTimePicker, - }; -}); +vi.mock('@mui/x-date-pickers/DateTimePicker', () => ({ + DateTimePicker: vi.importActual('@mui/x-date-pickers/DesktopDateTimePicker').DesktopDateTimePicker, +}));
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
src/screens/UserPortal/Campaigns/Campaigns.spec.tsx
(3 hunks)tsconfig.json
(1 hunks)
🔇 Additional comments (5)
tsconfig.json (1)
3-8
: LGTM: Vitest types correctly configured
The addition of "vitest/globals" to the types array is correct and necessary for TypeScript to recognize Vitest's global types.
src/screens/UserPortal/Campaigns/Campaigns.spec.tsx (4)
29-34
: LGTM: Toast mock correctly migrated to Vitest
The toast mock has been properly converted from Jest to Vitest syntax.
93-99
: LGTM: Router mock properly implemented
The react-router-dom mock is correctly implemented using Vitest's async mocking capabilities while preserving the actual router functionality.
103-103
: LGTM: Cleanup properly migrated
The cleanup function has been correctly updated to use Vitest's clearAllMocks.
Line range hint 1-324
: LGTM: Comprehensive test coverage maintained
The migration to Vitest has been completed while maintaining thorough test coverage across all key functionality:
- Component rendering
- User interactions
- Error handling
- Sorting and filtering
- Search functionality
- Modal operations
- Navigation
The test structure and assertions remain robust after the migration.
|
11ece4a
into
PalisadoesFoundation:develop-postgres
What kind of change does this PR introduce?
Refactoring
Issue Number:
#2571
Fixes #
Snapshots/Videos:
test_passed.webm
Summary
"vitest/globals"
intsconfig.json
to use typescript working with vitest globallyCampaigns.test.tsx
toCampaigns.spec.tsx
Does this PR introduce a breaking change?
No
Other information
Have you read the contributing guide?
Yes
Summary by CodeRabbit